﻿using System;
using System.Collections.Generic;
using System.Text;
using Sinacor.Infra.Service.Common;

namespace Sinacor.Servico.Bovespa.Corretagem.Service.ServiceImplementation.Translator.BusinessEntityToDataContract
{

    //Task  : 5617 
    // Data : 13/03/2009
    // Autor:Apsilva
    /// <summary>
    /// Classe Translator de Bussiness Entity para Data Contract
    /// </summary>
    public class DescontoCliente
    {
        public DataContract.Response.DescontoClienteResponse ToDescontoClienteResponse(BusinessEntity.DescontoCliente entity)
        {
            DataContract.Response.DescontoClienteResponse to = new Sinacor.Servico.Bovespa.Corretagem.Service.DataContract.Response.DescontoClienteResponse();
            to.ApelidoCliente = entity.ApelidoCliente;
            to.CodigoCliente = entity.CodigoCliente;
            to.PercentualDescontoAcresimo = entity.PercentualDescontoAcresimo;
            if (entity.TipoOperacao != null) 
                to.TipoOperacao = (DataContract.Enum.TipoOperacaoDesconto)entity.TipoOperacao;

            return to; 
        }

        public List<DataContract.Response.DescontoClienteResponse> ToDescontoClienteResponse(List<BusinessEntity.DescontoCliente> entity)
        {
            List<DataContract.Response.DescontoClienteResponse>  to = new List<DataContract.Response.DescontoClienteResponse>();
            foreach (BusinessEntity.DescontoCliente item in entity)
            {
                to.Add(ToDescontoClienteResponse(item)); 
            }
            return to;
        }
    }
}
